//
//  MycollectionViewController.m
//  yigou
//
//  Created by 秦乾龙 on 17/2/10.
//  Copyright © 2017年 hanyiwang. All rights reserved.
//

#import "MycollectionViewController.h"
#import "ZYButton.h"
#import "User.h"
#import "ContentListCell.h"
@interface MycollectionViewController ()<UITextFieldDelegate,UITextViewDelegate,UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,retain) UITableView *mainTableView;
@property (nonatomic,retain) NSMutableArray *allDataArr;

@end

@implementation MycollectionViewController

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    [self setUI];
}
- (void) setUI
{
    self.navigationItem.titleView = [ViewFactory makeNavigationTitle:@"我的关注"];
    
    UIBarButtonItem *backBtn = [ViewFactory makeNavigationBackWhite:self action:@selector(backClick)];
    self.navigationItem.leftBarButtonItem = backBtn;
    
    _mainTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0,ScreenW , ScreenH-64) style:UITableViewStyleGrouped];
    _mainTableView.delegate = self;
    _mainTableView.dataSource = self;
    [self.view addSubview:_mainTableView];
    
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return _allDataArr.count;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 1;
}
- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
//    static NSString * identifier = @"cell";
//    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    NSInteger number = indexPath.section - 4;
    
    NSArray *array = [NSArray new];
//    array = model.dynamicList;
    NSInteger count = array.count;
    NSDictionary *dic = [array objectAtIndex:number];
    //        if ([[[dic objectForKey:@"content"] objectForKey:@"content_type"]isEqualToString:@"00"]) {
    ContentListCell *cell = GET_CELL(ContentListCell,@"ContentListCell");
    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    [cell contentWithDic:dic];
    return cell;    //设置cell点击背景色不变
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    
//    User *user = [[User alloc]initWithDic:_allDataArr[indexPath.section]];
//    CGFloat headerImageH = 84*kScale;
//    UIImageView *headerImage = [[UIImageView alloc]init];
//    headerImage.frame = CGRectMake(30*kScale, 40*kScale,headerImageH, headerImageH);
//    //        [headerImage sd_setImageWithURL:shop[@"seller_logo"]];
//    headerImage.layer.masksToBounds = YES;
//    headerImage.layer.cornerRadius = 42*kScale;
//    //    headerImage.backgroundColor = [UIColor cyanColor];
//    [headerImage sd_setImageWithURL:[NSURL URLWithString:user.headerImageUrl]];
//    NSLog(@"99999%@",user.headerImageUrl);
//    [cell addSubview:headerImage];
//    UILabel *nameLable = [[UILabel alloc]init];
//    nameLable.font = [UIFont systemFontOfSize:15];
//    
//    nameLable.text = user.name;
//    nameLable.frame = CGRectMake(headerImageH+2*30*kScale, headerImage.frame.origin.y, ScreenW-(headerImageH+3*30*kScale), 36*kScale);
//    [cell addSubview:nameLable];
//    UILabel *introLable= [[UILabel alloc]init];
//    introLable.font = [UIFont systemFontOfSize:12];
//    introLable.text = [NSString stringWithFormat:@"%@",user.personSign];
//    //        CGSize priceSize = [introLable sizeThatFits:CGSizeMake(MAXFLOAT, 40*kScale)];
//    introLable.frame = CGRectMake(headerImageH+2*30*kScale, headerImage.frame.origin.y+headerImageH-40*kScale, ScreenW-3*30*kScale-50*kScale-178*kScale-headerImageH, 36*kScale);
//    introLable.textColor = ZallColorFromRGB(0x616161);
//    [cell addSubview:introLable];
//    
//    ZYButton *stateBtn = [[ZYButton alloc]initWithFrame:CGRectMake(ScreenW-30*kScale-178*kScale, 61*kScale, 178*kScale,60*kScale)];
//    stateBtn.followUserId = user.userId;
//    stateBtn.titleLabel.font = [UIFont systemFontOfSize:15];
//    stateBtn.tag = indexPath.section;
//    stateBtn.layer.cornerRadius  = 8*kScale;
//    stateBtn.layer.masksToBounds = YES;
//    //    stateBtn.layer.borderWidth = 1.0f;
//    //    stateBtn.layer.borderColor = [UIColor lightGrayColor].CGColor;
//    stateBtn.backgroundColor = ZallColorFromRGB(0x1fa2b6);
//    [stateBtn setTitle:@"取消关注" forState:UIControlStateNormal];
//    [stateBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
//    [stateBtn addTarget:self action:@selector(cancleCareClick:) forControlEvents:UIControlEventTouchUpInside];
//    [cell addSubview:stateBtn];
    
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return  164*kScale;
}
- (CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    if (section == 0) {
        return  0.01;
    }
    
    return 20*kScale;
}
- (CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 0.01;
}
//返回
- (void)backClick
{
    [self.navigationController popViewControllerAnimated:YES];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
//    NSInteger number = indexPath.section - 4;
//    
//    NSArray *array = [NSArray new];
//    array = model.dynamicList;
//    NSInteger count = array.count;
//    NSDictionary *dic = [array objectAtIndex:number];
//    //        if ([[[dic objectForKey:@"content"] objectForKey:@"content_type"]isEqualToString:@"00"]) {
//    ContentListCell *cell = GET_CELL(ContentListCell,@"ContentListCell");
//    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
//    [cell contentWithDic:dic];
//    return cell;
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
